from rest_framework import serializers

class SegmentParamSerializer(serializers.Serializer):
    # 这里根据实际参数补充字段
    ship_number = serializers.CharField(required=True)
    block_number = serializers.CharField(required=True)
    shape = serializers.CharField(required=False, allow_blank=True)
    type = serializers.CharField(required=False, allow_blank=True)
    length = serializers.FloatField(required=False)
    width = serializers.FloatField(required=False)
    height = serializers.FloatField(required=False, allow_null=True)
    weight = serializers.FloatField(required=False)
    base_start = serializers.CharField(required=True)
    building_period = serializers.IntegerField(required=False)
    output_value = serializers.FloatField(required=False)
    earliest_start = serializers.CharField(required=False, allow_blank=True, allow_null=True)
    latest_start = serializers.CharField(required=False, allow_blank=True, allow_null=True)
    scheduled_start = serializers.CharField(required=False, allow_blank=True, allow_null=True)
    scheduled_finish = serializers.CharField(required=False, allow_blank=True, allow_null=True)
    mold_position = serializers.CharField(required=False, allow_blank=True, allow_null=True)
    is_combined = serializers.BooleanField(required=False)
    combined_segments = serializers.CharField(required=False, allow_blank=True, allow_null=True)
    paired_segment = serializers.CharField(required=False, allow_blank=True, allow_null=True)
    pre_work = serializers.CharField(required=False, allow_blank=True, allow_null=True)
    placement_type = serializers.CharField(required=False, allow_blank=True, allow_null=True)

class MoldPositionParamSerializer(serializers.Serializer):
    # 这里根据实际参数补充字段
    position_ID = serializers.CharField(required=True)
    description = serializers.CharField(required=True)
    length = serializers.FloatField(required=False)
    width = serializers.FloatField(required=False)
    labor_team = serializers.CharField(required=False, allow_blank=True)

class ScheduleRequestSerializer(serializers.Serializer):
    segments = SegmentParamSerializer(many=True)
    mold_positions = MoldPositionParamSerializer(many=True)
    rule = serializers.CharField(required=False, allow_blank=True)

class ScheduleResultSerializer(serializers.Serializer):
    segment_id = serializers.IntegerField()
    block_number = serializers.CharField()
    mold_position = serializers.CharField(allow_null=True)
    scheduled_start = serializers.CharField()
    scheduled_finish = serializers.CharField()
    delay = serializers.FloatField()
    ship_number = serializers.CharField() 